Skip to content

Conversation

@MatLBS
Copy link
Contributor

@MatLBS MatLBS commented Feb 9, 2026

Fix #146

  • Connection was working but schemas were not loaded correctly
  • Did not found a way to fix the issue using ibis. Had to use 'redshift_connector'

@claude
Copy link

claude bot commented Feb 9, 2026

Code Review

I found 2 issues that need to be addressed:


1. 🐛 Critical Bug: Connection Type Mismatch

Location: cli/nao_core/commands/sync/providers/databases/redshift.py lines 26 and 67

Issue:
The connect() method now returns a redshift_connector.Connection object instead of an ibis.BaseBackend, but in sync_redshift() this connection is still passed to accessor.generate(conn, schema, table) on line 67.

The accessors in cli/nao_core/commands/sync/accessors.py expect an Ibis backend and call Ibis-specific methods like:

  • conn.table(table, database=dataset) (line 73)
  • .schema(), .limit().execute(), .count().execute() on the returned table

A redshift_connector.Connection object does not have a .table() method, so every accessor call will raise AttributeError.

Impact:
While the error is caught (line 64 of accessors.py), every single table's sync output will contain only an error message instead of actual column, preview, description, and profiling data. The sync operation will produce broken/empty documentation for all Redshift tables.

Evidence:

Suggested Fix:
The PR correctly migrated list_schemas() and list_tables() away from Ibis, but the accessor pipeline was overlooked. You need to either:

  1. Migrate the accessors to work with raw redshift_connector.Connection objects (using SQL queries directly), or
  2. Keep using Ibis for the accessor pipeline while using redshift_connector only for schema/table listing

2. ⚠️ CLAUDE.md Violation: SOLID Principles

Location: cli/nao_core/commands/debug.py lines 56-59

Issue:
The special case check for Redshift violates the SOLID principles stated in CLAUDE.md:

"Follow SOLID principles — single responsibility, depend on abstractions"

The Problem:
This code depends on a concrete database type (db_config.type == "redshift") rather than the abstraction layer. All other database types follow the standard flow using the connect() method from the abstract base class (see debug.py#L61-L77), but Redshift bypasses this with type-specific logic in the calling code.

Suggested Fix:
The abstraction should be fixed in the RedshiftConfig class itself rather than adding special-case handling here. Either:

  1. Make RedshiftConfig.connect() return an Ibis backend like other configs (if possible), or
  2. Create an abstract test_connection() method in the base class that each config implements appropriately

Note: Both issues stem from the same root cause - the incomplete migration from Ibis to redshift_connector. The migration successfully updated schema/table listing but missed the connection testing and data accessor flows.

@MatLBS MatLBS marked this pull request as draft February 10, 2026 09:00
@Bl3f
Copy link
Contributor

Bl3f commented Feb 10, 2026

Fixed by #166.

@Bl3f Bl3f closed this Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nao sync doesn't work with redshift

2 participants